<template>
  <div>
    <el-button text @click="changeLanguage(locale == 'zh' ? 'en' : 'zh')">
      <span>
        <svg-icon :iconClass="locale == 'zh' ? 'zh' : 'en'"></svg-icon>
      </span>
    </el-button>
  </div>
</template>

<script setup lang="ts">
  import i18n from '@/i18n/index'
  const { locale } = i18n.global
  /**
   * @Author { Paraboy }
   * @Method { changeLanguage }
   * @Describe { 切换语言 }
   * @Param {  }
   * @Return {  }
   */
  const changeLanguage = (lang: 'zh' | 'en') => {
    locale.value = lang
    localStorage.setItem('i18nLocale', lang)
  }
</script>

<style scoped lang="scss">
  :deep(.el-tooltip__trigger:focus-visible) {
    outline: none !important;
  }
</style>
